//
//  OrmmaConstants.h
//  AdMobileSDK
//
//  Created by Constantine Mureev on 8/29/11.
//

#define ORMMA_PLACEHOLDER @"<!-- ORMMA_PLACEHOLDER -->"

#define ORMMA_LEVEL_1                           @"'level-1'"
#define ORMMA_LEVEL_2                           @"'level-2'"
#define ORMMA_LEVEL_3                           @"'level-3'"
#define ORMMA_ORIENTATION                       @"'orientation'"
#define ORMMA_NETWORK                           @"'network'"
#define ORMMA_SCREEN                            @"'screen'"
#define ORMMA_SHAKE                             @"'shake'"
#define ORMMA_SIZE                              @"'size'"
#define ORMMA_TILT                              @"'tilt'"
#define ORMMA_AUDIO                             @"'audio'"
#define ORMMA_VIDEO                             @"'video'"
#define ORMMA_MAP                               @"'map'"
#define ORMMA_CALENDAR                          @"'calendar'"
#define ORMMA_HEADING                           @"'heading'"
#define ORMMA_LOCATION                          @"'location'"
#define ORMMA_IPHONE                            @"'phone'"
#define ORMMA_EMAIL                             @"'email'"
#define ORMMA_SMS                               @"'sms'"

#define ORMMA_REGISTER_UP_CASE_OBJECT           @"window.Ormma=window.ormma;"
#define ORMMA_SIGNAL_READY_FOR_WEBVIEW          @"window.ormma.signalReady();"

#define ORMMA_WINDOW_NATIVE_CALL_COMPLETE       @"window.ormmaview.nativeCallComplete"
#define ORMMA_WINDOW_FIRE_RESPONSE_EVENT        @"window.ormmaview.fireResponseEvent"
#define ORMMA_WINDOW_FIRE_CHANGE_EVENT          @"window.ormmaview.fireChangeEvent"
#define ORMMA_WINDOW_FIRE_SHAKE_EVENT           @"window.ormmaview.fireShakeEvent();"
#define ORMMA_WINDOW_FIRE_ERROR_EVENT           @"window.ormmaview.fireErrorEvent"

#define ORMMA_EVENT_DEFAULT_STATE               @"{state: 'default'}"
#define ORMMA_EVENT_EXPAND_STATE                @"{state: 'expanded'}"
#define ORMMA_EVENT_HIDDEN_STATE                @"{state: 'hidden'}"
#define ORMMA_EVENT_RESIZE_STATE                @"{state: 'resized'}"
#define ORMMA_EVENT_DEFAULT_STATE               @"{state: 'default'}"
#define ORMMA_EVENT_VIEWABLE_TRUE               @"{viewable: true}"
#define ORMMA_EVENT_VIEWABLE_FALSE              @"{viewable: false}"
#define ORMMA_EVENT_PLACEMENT_TYPE_INTERSTITIAL @"{placementType: 'interstitial'}"
#define ORMMA_EVENT_PLACEMENT_TYPE_INLINE       @"{placementType: 'inline'}"
#define ORMMA_EVENT_KEYBOARD_STATE_TRUE         @"{keyboardState: true}"
#define ORMMA_EVENT_KEYBOARD_STATE_FALSE        @"{keyboardState: false}"

#define ORMMA_EVENT_ENABLED                     @"ormmaenabled"
#define ORMMA_EVENT_SHOW                        @"show"
#define ORMMA_EVENT_HIDE                        @"hide"
#define ORMMA_EVENT_CLOSE                       @"close"
#define ORMMA_EVENT_EXPAND                      @"expand"
#define ORMMA_EVENT_RESIZE                      @"resize"
#define ORMMA_EVENT_ADDASSET                    @"addasset"
#define ORMMA_EVENT_REMOVEASSET                 @"removeasset"
#define ORMMA_EVENT_REMOVE_ALL_ASSET            @"removeallassets"
#define ORMMA_EVENT_CALENDAR                    @"calendar"
#define ORMMA_EVENT_CAMERA                      @"camera"
#define ORMMA_EVENT_EMAIL                       @"email"
#define ORMMA_EVENT_PHONE                       @"phone"
#define ORMMA_EVENT_SMS                         @"sms"
#define ORMMA_EVENT_OPEN                        @"open"
#define ORMMA_EVENT_OPEN_MAP                    @"openmap"
#define ORMMA_EVENT_PLAY_AUDIO                  @"playaudio"
#define ORMMA_EVENT_PLAY_VIDEO                  @"playvideo"
#define ORMMA_EVENT_REQUEST                     @"request"
#define ORMMA_EVENT_SERVICE                     @"service"

#define ORMMA_EVENT_NETWORK                     @"network:"
#define ORMMA_EVENT_SIZE                        @"size:"
#define ORMMA_EVENT_MAX_SIZE                    @"maxSize:"
#define ORMMA_EVENT_SCREEN_SIZE                 @"screenSize:"
#define ORMMA_EVENT_DEFAULT_POSITION            @"defaultPosition:"
#define ORMMA_EVENT_EXPAND_PROPERTIES           @"expandProperties:"
#define ORMMA_EVENT_ORIENTATION                 @"orientation:"
#define ORMMA_EVENT_SUPPORTS                    @"supports:"
#define ORMMA_EVENT_TILT                        @"tilt:"
#define ORMMA_EVENT_HEADING                     @"heading:"
#define ORMMA_EVENT_LOCATION                    @"location:"

#define ORMMA_JS @"window.init_ormmaview=function(){var b=window.ormmaview={},j={width:100,height:100,useCustomClose:!1,isModal:!1,lockOrientation:!1,useBackground:!1,backgroundColor:\"#ffffff\",backgroundOpacity:1},c={},i=[],p=!1,n=!1;b.fireAssetReadyEvent=function(b,g){var e=c.assetReady;if(e!=null)for(var h=0;h<e.length;h++)e[h](b,g);return\"OK\"};b.fireAssetRemovedEvent=function(b){var g=c.assetRemoved;if(g!=null)for(var e=0;e<g.length;e++)g[e](b);return\"OK\"};b.fireAssetRetiredEvent=function(b){var g=c.assetRetired; if(g!=null)for(var e=0;e<g.length;e++)g[e](b);return\"OK\"};b.fireChangeEvent=function(b){var g=c.change;if(g!=null)for(var e=0;e<g.length;e++)g[e](b);return\"OK\"};b.fireErrorEvent=function(b,g){var e=c.error;if(e!=null)for(var h=0;h<e.length;h++)e[h](b,g);return\"OK\"};b.fireShakeEvent=function(){var b=c.shake;if(b!=null)for(var g=0;g<b.length;g++)b[g]();return\"OK\"};b.fireResponseEvent=function(b,g){var e=c.response;if(e!=null)for(var h=0;h<e.length;h++)e[h](b,g);return\"OK\"};b.nativeCallComplete=function(){if(i.length== 0)p=!1;else{var b=i.pop();window.location=b;return\"OK\"}};b.showAlert=function(b){alert(b)};b.zeroPad=function(b){var g=\"\";b<10&&(g+=\"0\");g+=b;return g};b.executeNativeCall=function(b){for(var g=\"ormma://\"+b,c,h=!0,j=1;j<arguments.length;j+=2)c=arguments[j+1],c!=null&&(h?(g+=\"?\",h=!1):g+=\"&\",g+=arguments[j]+\"=\"+escape(c));p||!n?i.push(g):(p=!0,window.location=g)};b.activate=function(b){this.executeNativeCall(\"service\",\"name\",b,\"enabled\",\"Y\")};b.addEventListener=function(b,g){var e=c[b];e==null&&(c[b]= [],e=c[b]);for(var h in e)if(g==h)return;e.push(g)};b.deactivate=function(b){this.executeNativeCall(\"service\",\"name\",b,\"enabled\",\"N\")};b.removeEventListener=function(b,g){var e=c[b];e!=null&&e.remove(g)};b.close=function(){this.executeNativeCall(\"close\")};b.expand=function(b){this.executeNativeCall(\"expand\",\"url\",b,\"width\",j.width,\"height\",j.height,\"useCustomClose\",j.useCustomClose,\"isModal\",j.isModal,\"useBackground\",j.useBackground,\"backgroundColor\",j.backgroundColor,\"backgroundOpacity\",j.backgroundOpacity, \"lockOrientation\",j.lockOrientation)};b.hide=function(){this.executeNativeCall(\"hide\")};b.open=function(b){this.executeNativeCall(\"open\",\"url\",b)};b.openMap=function(b,c){this.executeNativeCall(\"openMap\",\"url\",b,\"fullscreen\",c)};b.resize=function(b,c){this.executeNativeCall(\"resize\",\"w\",b,\"h\",c)};b.getExpandProperties=function(){return j};b.setExpandProperties=function(b){var c=\"width,height,useCustomClose,isModal,lockOrientation,useBackground,backgroundColor,backgroundOpacity\".split(\",\");for(f in c){var e= c[f];b[e]!==void 0&&(j[e]=b[e])}};b.show=function(){this.executeNativeCall(\"show\")};b.storePicture=function(b){this.executeNativeCall(\"storePicture\",\"url\",b)};b.useCustomClose=function(b){j.useCustomClose=b};b.playAudio=function(b,c){var e=\"this.executeNativeCall( 'playAudio'\";e+=\", 'url', '\"+b+\"'\";c!=null&&(e+=typeof c.autoplay!=\"undefined\"&&c.autoplay!=null?\", 'autoplay', 'Y'\":\", 'autoplay', 'N'\",e+=typeof c.controls!=\"undefined\"&&c.controls!=null?\", 'controls', 'Y'\":\", 'controls', 'N'\",e+=typeof c.loop!= \"undefined\"&&c.loop!=null?\", 'loop', 'Y'\":\", 'loop', 'N'\",e+=typeof c.position!=\"undefined\"&&c.position!=null?\", 'position', 'Y'\":\", 'position', 'N'\",e+=typeof c.startStyle!=\"undefined\"&&c.startStyle!=null?\", 'startStyle', '\"+c.startStyle+\"'\":\", 'startStyle', 'normal'\",e+=typeof c.stopStyle!=\"undefined\"&&c.stopStyle!=null?\", 'stopStyle', '\"+c.stopStyle+\"'\":\", 'stopStyle', 'normal'\");e+=\" );\";eval(e)};b.playVideo=function(b,c){var e=\"this.executeNativeCall( 'playVideo'\";e+=\", 'url', '\"+b+\"'\";c!=null&& (e+=typeof c.audio!=\"undefined\"&&c.audio!=null?\", 'audioMuted', 'Y'\":\", 'audioMuted', 'N'\",e+=typeof c.autoplay!=\"undefined\"&&c.autoplay!=null?\", 'autoplay', 'Y'\":\", 'autoplay', 'N'\",e+=typeof c.controls!=\"undefined\"&&c.controls!=null?\", 'controls', 'Y'\":\", 'controls', 'N'\",e+=typeof c.loop!=\"undefined\"&&c.loop!=null?\", 'loop', 'Y'\":\", 'loop', 'N'\",typeof c.position!=\"undefined\"&&c.position!=null&&(e+=\", 'position_top', '\"+c.position.top+\"'\",e+=\", 'position_left', '\"+c.position.left+\"'\",typeof c.width!= \"undefined\"&&c.width!=null&&(e+=\", 'position_width', '\"+c.width+\"'\"),typeof c.height!=\"undefined\"&&c.height!=null&&(e+=\", 'position_height', '\"+c.height+\"'\")),e+=typeof c.startStyle!=\"undefined\"&&c.startStyle!=null?\", 'startStyle', '\"+c.startStyle+\"'\":\", 'startStyle', 'normal'\",e+=typeof c.stopStyle!=\"undefined\"&&c.stopStyle!=null?\", 'stopStyle', '\"+c.stopStyle+\"'\":\", 'stopStyle', 'normal'\");e+=\" );\";eval(e)};b.createEvent=function(c,b,e){var h=c.getFullYear(),i=c.getMonth()+1,j=c.getDate(),n=c.getHours(), c=c.getMinutes();this.executeNativeCall(\"calendar\",\"date\",h+this.zeroPad(i)+this.zeroPad(j)+this.zeroPad(n)+this.zeroPad(c),\"title\",b,\"body\",e)};b.makeCall=function(c){this.executeNativeCall(\"phone\",\"number\",c)};b.sendMail=function(c,b,e){this.executeNativeCall(\"email\",\"to\",c,\"subject\",b,\"body\",e,\"html\",\"N\")};b.sendSMS=function(c,b){this.executeNativeCall(\"sms\",\"to\",c,\"body\",b)};b.setShakeProperties=function(){};b.addAsset=function(c,b){this.executeNativeCall(\"addasset\",\"uri\",url,\"alias\",b)};b.request= function(c,b){this.executeNativeCall(\"request\",\"uri\",c,\"display\",b)};b.removeAsset=function(c){this.executeNativeCall(\"removeasset\",\"alias\",c)};document.addEventListener(\"DOMContentLoaded\",function(){n=!0;this.nativeCallComplete()})};window.ormmaview||window.init_ormmaview();window.init_ormma=function(){var b=window.ormma={},j=b.STATES={UNKNOWN:\"unknown\",DEFAULT:\"default\",RESIZED:\"resized\",EXPANDED:\"expanded\",HIDDEN:\"hidden\"},c=b.EVENTS={ASSETREADY:\"assetReady\",ASSETREMOVED:\"assetRemoved\",ASSETRETIRED:\"assetRetired\",ERROR:\"error\",INFO:\"info\",HEADINGCHANGE:\"headingChange\",KEYBOARDCHANGE:\"keyboardChange\",LOCATIONCHANGE:\"locationChange\",NETWORKCHANGE:\"networkChange\",ORIENTATIONCHANGE:\"orientationChange\",READY:\"ready\",RESPONSE:\"response\",SCREENCHANGE:\"screenChange\",SHAKE:\"shake\", SIZECHANGE:\"sizeChange\",STATECHANGE:\"stateChange\",TILTCHANGE:\"tiltChange\",VIEWABLECHANGE:\"viewableChange\"};b.CONTROLS={BACK:\"back\",FORWARD:\"forward\",REFRESH:\"refresh\",ALL:\"all\"};var i=b.FEATURES={LEVEL1:\"level-1\",LEVEL2:\"level-2\",LEVEL3:\"level-3\",SCREEN:\"screen\",ORIENTATION:\"orientation\",HEADING:\"heading\",LOCATION:\"location\",SHAKE:\"shake\",TILT:\"tilt\",NETWORK:\"network\",SMS:\"sms\",PHONE:\"phone\",EMAIL:\"email\",CALENDAR:\"calendar\",CAMERA:\"camera\",AUDIO:\"audio\",VIDEO:\"video\",MAP:\"map\"},p=b.NETWORK={OFFLINE:\"offline\", WIFI:\"wifi\",CELL:\"cell\",UNKNOWN:\"unknown\"},n=j.UNKNOWN,u={width:0,height:0},g={x:0,y:0,width:0,height:0},e={width:0,height:0},h={\"level-1\":!0,\"level-2\":!0,\"level-3\":!0,screen:!0,orientation:!0,heading:!0,location:!0,shake:!0,tilt:!0,network:!0,sms:!0,phone:!0,email:!0,calendar:!0,camera:!0,audio:!0,video:!0,map:!0},w=-1,x=!1,q=null,s=p.UNKNOWN,y=-1,A=\"inline\",t=null,v={interval:10,intensity:20},r=null,m={},B=-1,z=!1,E={width:function(a){return!isNaN(a)&&a>0},height:function(a){return!isNaN(a)&&a> 0},useCustomClose:function(a){return a===!0||a===!1},isModal:function(a){return a===!0||a===!1},lockOrientation:function(a){return a===!0||a===!1},useBackground:function(a){return a===!0||a===!1},backgroundColor:function(a){return typeof a==\"string\"&&a.substr(0,1)==\"#\"&&!isNaN(parseInt(a.substr(1),16))},backgroundOpacity:function(a){return!isNaN(a)&&a>=0&&a<=1}},F={intensity:function(a){return!isNaN(a)},interval:function(a){return!isNaN(a)}},G={state:function(a){d(c.INFO,\"setting state to \"+k(a)); n=a;d(c.STATECHANGE,n)},size:function(a){d(c.INFO,\"setting size to \"+k(a));u=a;d(c.SIZECHANGE,u.width,u.height)},defaultPosition:function(a){d(c.INFO,\"setting default position to \"+k(a));g=a},maxSize:function(a){d(c.INFO,\"setting maxSize to \"+k(a));e=a},expandProperties:function(a){d(c.INFO,\"merging expandProperties with \"+k(a));ormmaview.setExpandProperties(a)},supports:function(a){d(c.INFO,\"setting supports to \"+k(a));h={};for(var b in i)h[i[b]]=C(i[b],a)},heading:function(a){d(c.INFO,\"setting heading to \"+ k(a));w=a;d(c.HEADINGCHANGE,w)},keyboardState:function(a){d(c.INFO,\"setting keyboardState to \"+k(a));x=a;d(c.KEYBOARDCHANGE,x)},location:function(a){d(c.INFO,\"setting location to \"+k(a));q=a;d(c.LOCATIONCHANGE,q.lat,q.lon,q.acc)},network:function(a){d(c.INFO,\"setting network to \"+k(a));s=a;d(c.NETWORKCHANGE,s!=p.OFFLINE&&s!=p.UNKNOWN,s)},orientation:function(a){d(c.INFO,\"setting orientation to \"+k(a));y=a;d(c.ORIENTATIONCHANGE,y)},placementType:function(a){d(c.INFO,\"setting placementType to \"+k(a)); A=a},screenSize:function(a){d(c.INFO,\"setting screenSize to \"+k(a));t=a;d(c.SCREENCHANGE,t.width,t.height)},shakeProperties:function(a){d(c.INFO,\"setting shakeProperties to \"+k(a));v=a},tilt:function(a){d(c.INFO,\"setting tilt to \"+k(a));r=a;d(c.TILTCHANGE,r.x,r.y,r.z)},cacheRemaining:function(a){d(c.INFO,\"setting cacheRemaining to \"+k(a));B=a},viewable:function(a){d(c.INFO,\"setting viewable to \"+k(a));z=a;d(c.VIEWABLECHANGE,a)}},l={},H=function(a){this.event=a;this.count=0;var c={};this.add=function(b){var d= String(b);c[d]||(c[d]=b,this.count++,this.count==1&&ormmaview.activate(a))};this.remove=function(b){b=String(b);return c[b]?(c[b]=null,delete c[b],this.count--,this.count==0&&ormmaview.deactivate(a),!0):!1};this.removeAll=function(){for(var a in c)this.remove(c[a])};this.broadcast=function(a){for(var b in c)c[b].apply({},a)};this.toString=function(){var b=[a,\":\"],d;for(d in c)b.push(\"|\",d,\"|\");return b.join(\"\")}};ormmaview.addEventListener(\"change\",function(a){for(var c in a)(0,G[c])(a[c])});ormmaview.addEventListener(\"shake\", function(){d(c.SHAKE)});ormmaview.addEventListener(\"error\",function(a,b){d(c.ERROR,a,b)});ormmaview.addEventListener(\"response\",function(a,b){d(c.RESPONSE,a,b)});ormmaview.addEventListener(\"assetReady\",function(a,b){m[a]=b;d(c.ASSETREADY,a)});ormmaview.addEventListener(\"assetRemoved\",function(a){m[a]=null;delete m[a];d(c.ASSETREMOVED,a)});ormmaview.addEventListener(\"assetRetired\",function(a){m[a]=null;delete m[a];d(c.ASSETRETIRED,a)});var o=function(a){var c=function(){};c.prototype=a;return new c}, k=function(a){if(typeof a==\"object\")if(a.push){var c=[],b;for(b in a)c.push(a[b]);return\"[\"+c.join(\",\")+\"]\"}else{c=[];for(b in a)c.push(\"'\"+b+\"':\"+a[b]);return\"{\"+c.join(\",\")+\"}\"}else return String(a)},D=function(a,b,e,h){if(h)if(a===void 0)return d(c.ERROR,\"Required object missing.\",e),!1;else for(var g in b)if(a[g]===void 0)return d(c.ERROR,\"Object missing required property \"+g,e),!1;for(g in a)if(b[g]){if(!b[g](a[g]))return d(c.ERROR,\"Value of property \"+g+\" is not valid type.\",e),!1}else return d(c.ERROR, \"Invalid property specified - \"+g+\".\",e),!1;return!0},C=function(a,c){for(var b in c)if(c[b]==a)return!0;return!1},d=function(){for(var a=Array(arguments.length),c=0;c<arguments.length;c++)a[c]=arguments[c];c=a.shift();l[c]&&l[c].broadcast(a)};b.signalReady=function(){window.ORMMAReady&&ORMMAReady();d(c.READY);d(c.INFO,\"callback invoked\")};b.addEventListener=function(a,b){!a||!b?d(c.ERROR,\"Both event and listener are required.\",\"addEventListener\"):C(a,c)?(l[a]||(l[a]=new H(a)),l[a].add(b)):d(c.ERROR, \"Unknown event: \"+a,\"addEventListener\")};b.close=function(){ormmaview.close()};b.expand=function(a){ormmaview.expand(a)};b.getDefaultPosition=function(){return o(g)};b.getExpandProperties=function(){return o(ormmaview.getExpandProperties())};b.getMaxSize=function(){return o(e)};b.getSize=function(){return o(u)};b.getState=function(){return n};b.hide=function(){n==j.HIDDEN?d(c.ERROR,\"Ad is currently hidden.\",\"hide\"):ormmaview.hide()};b.isViewable=function(){return z};b.open=function(a){a?ormmaview.open(a): d(c.ERROR,\"URL is required.\",\"open\")};b.openMap=function(a,b){a?ormmaview.openMap(a,b):d(c.ERROR,\"POI is required.\",\"openMap\")};b.removeEventListener=function(a,b){a?b&&(!l[a]||!l[a].remove(b))?d(c.ERROR,\"Listener not currently registered for event\",\"removeEventListener\"):(l[a]&&l[a].removeAll(),l[a]&&l[a].count==0&&(l[a]=null,delete l[a])):d(c.ERROR,\"Must specify an event.\",\"removeEventListener\")};b.resize=function(a,b){a==null||b==null||isNaN(a)||isNaN(b)||a<0||b<0?d(c.ERROR,\"Requested size must be numeric values between 0 and maxSize.\", \"resize\"):a>e.width||b>e.height?d(c.ERROR,\"Request (\"+a+\" x \"+b+\") exceeds maximum allowable size of (\"+e.width+\" x \"+e.height+\")\",\"resize\"):ormmaview.resize(a,b)};b.setExpandProperties=function(a){D(a,E,\"setExpandProperties\")&&ormmaview.setExpandProperties(a)};b.show=function(){n!=j.HIDDEN?d(c.ERROR,\"Ad is currently visible.\",\"show\"):ormmaview.show()};b.playAudio=function(a,b){h[i.AUDIO]?!a||typeof a!=\"string\"?d(c.ERROR,\"Request must specify a URL\",\"playAudio\"):ormmaview.playAudio(a,b):d(c.ERROR, \"Method not supported by this client.\",\"playAudio\")};b.playVideo=function(a,b){h[i.VIDEO]?!a||typeof a!=\"string\"?d(c.ERROR,\"Request must specify a URL\",\"playVideo\"):ormmaview.playVideo(a,b):d(c.ERROR,\"Method not supported by this client.\",\"playVideo\")};b.createEvent=function(a,b,e){b=b.replace(/^\\s+|\\s+$/g,\"\");e=e.replace(/^\\s+|\\s+$/g,\"\");h[i.CALENDAR]?!a||typeof a!=\"object\"||!a.getDate?d(c.ERROR,\"Valid date required.\",\"createEvent\"):!b||typeof b!=\"string\"||b.length==0?d(c.ERROR,\"Valid title required.\", \"createEvent\"):!e||typeof e!=\"string\"||e.length==0?d(c.ERROR,\"Valid body required.\",\"createEvent\"):ormmaview.createEvent(a,b,e):d(c.ERROR,\"Method not supported by this client.\",\"createEvent\")};b.getHeading=function(){h[i.HEADING]||d(c.ERROR,\"Method not supported by this client.\",\"getHeading\");return w};b.getKeyboardState=function(){h[i.LEVEL2]||d(c.ERROR,\"Method not supported by this client.\",\"getKeyboardState\");return x};b.getLocation=function(){h[i.LOCATION]||d(c.ERROR,\"Method not supported by this client.\", \"getLocation\");return null==q?null:o(q)};b.getNetwork=function(){h[i.NETWORK]||d(c.ERROR,\"Method not supported by this client.\",\"getNetwork\");return s};b.getOrientation=function(){h[i.ORIENTATION]||d(c.ERROR,\"Method not supported by this client.\",\"getOrientation\");return y};b.getPlacementType=function(){return A};b.getScreenSize=function(){if(h[i.SCREEN])return null==t?null:o(t);else d(c.ERROR,\"Method not supported by this client.\",\"getScreenSize\")};b.getShakeProperties=function(){if(h[i.SHAKE])return null== v?null:o(v);else d(c.ERROR,\"Method not supported by this client.\",\"getShakeProperties\")};b.getTilt=function(){if(h[i.TILT])return null==r?null:o(r);else d(c.ERROR,\"Method not supported by this client.\",\"getTilt\")};b.getVersion=function(){return\"1.1.0\"};b.makeCall=function(a){h[i.PHONE]?!a||typeof a!=\"string\"?d(c.ERROR,\"Request must provide a number to call.\",\"makeCall\"):ormmaview.makeCall(a):d(c.ERROR,\"Method not supported by this client.\",\"makeCall\")};b.sendMail=function(a,b,e){h[i.EMAIL]?!a||typeof a!= \"string\"?d(c.ERROR,\"Request must specify a recipient.\",\"sendMail\"):ormmaview.sendMail(a,b,e):d(c.ERROR,\"Method not supported by this client.\",\"sendMail\")};b.sendSMS=function(a,b){h[i.SMS]?!a||typeof a!=\"string\"?d(c.ERROR,\"Request must specify a recipient.\",\"sendSMS\"):ormmaview.sendSMS(a,b):d(c.ERROR,\"Method not supported by this client.\",\"sendSMS\")};b.setShakeProperties=function(a){h[i.SHAKE]?D(a,F,\"setShakeProperties\")&&(v=a,ormmaview.setShakeProperties(a)):d(c.ERROR,\"Method not supported by this client.\", \"setShakeProperties\")};b.storePicture=function(a){ormmaview.storePicture(a)};b.supports=function(a){return h[a]?!0:!1};b.useCustomClose=function(a){a===!0||a===!1?ormmaview.useCustomClose(a):d(c.ERROR,\"Flag must be boolean\",\"useCustomClose\")};b.addAsset=function(a,b){!a||!b||typeof a!=\"string\"||typeof b!=\"string\"?d(c.ERROR,\"URL and alias are required.\",\"addAsset\"):h[i.LEVEL3]?ormmaview.addAsset(a,b):a.indexOf(\"ormma://\")==0?d(c.ERROR,\"Native device assets not supported by this client.\",\"addAsset\"): (m[b]=a,d(c.ASSETREADY,b))};b.addAssets=function(a){for(var c in a)b.addAsset(a[c],c)};b.getAssetURL=function(a){m[a]||d(c.ERROR,\"Alias unknown.\",\"getAssetURL\");return m[a]};b.getCacheRemaining=function(){h[i.LEVEL3]||d(c.ERROR,\"Method not supported by this client.\",\"getCacheRemaining\");return B};b.request=function(a,b){h[i.LEVEL3]?!a||typeof a!=\"string\"?d(c.ERROR,\"URI is required.\",\"request\"):ormmaview.request(a,b):d(c.ERROR,\"Method not supported by this client.\",\"request\")};b.removeAllAssets=function(){for(var a in m)b.removeAsset(a)}; b.removeAsset=function(a){!a||typeof a!=\"string\"?d(c.ERROR,\"Alias is required.\",\"removeAsset\"):m[a]?h[i.LEVEL3]?ormmaview.removeAsset(a):(m[a]=null,delete m[a],d(c.ASSETREMOVED,a)):d(c.ERROR,\"Alias unknown.\",\"removeAsset\")};b.getViewable=function(){return z}};window.ormma||window.init_ormma();window.Ormma=window.ormma;window.mraid=window.ormma;"